const express = require('express')
const app = express()

// 定义中间件函数
const mw1 = (req, res, next) => {
    console.log('调用了局部生效的中间件1');
    next()
}

const mw2 = (req, res, next) => {
        console.log('调用了局部生效的中间件2');
    }
    // 路由
app.get('/', mw1, (req, res) => {
    res.send('home page')
})

app.listen(23, () => {
    console.log('server is running at http://127.0.0.1');
})